<?php

namespace CNAM\ActimanBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class OperationType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nomOperation', 'text', array('attr' => array('style' => 'width:95%')))
            ->add('description', 'textarea', array('required' => false))
            ->add('delaiOperation', 'text', array('attr' => array('style' => 'width:95%')))
            ->add('dependanceOperation', 'text', array('attr' => array('style' => 'width:95%')))
            ->add('Service','entity',array('class'=> 'CNAMActimanBundle:Service','property' => 'nomService','empty_value' => 'Choisir un service', 'attr' => array('style' => 'width:95%')))
        ;
    }
   
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'CNAM\ActimanBundle\Entity\Operation'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'cnam_actimanbundle_operation';
    }
}
